<?php

class Webmix_Form_Company_Request extends Engine_Form {
	public function init() {
//		$this->setTitle ( 'Country' );
		$this->setDescription ( 'Choose country to request to admin.')
		->setAction ( Zend_Controller_Front::getInstance ()->getRouter ()->assemble ( array () ) );
		
		$table = Engine_Api::_()->getDbtable('countries', 'webmix');
		$countries = $table->fetchAll($table->select()->where('selected = 0'));
		$localeMultiOptions = array();
		foreach ($countries as $item){
			$localeMultiOptions[$item->getIdentity()] = $item->title;	
		}
		
		$this->addElement ( 'Select', 'country',
				 array ('label' => 'Country',
				  //'description' => 'Which language do you want to create a language pack for?',
				  'multiOptions' => $localeMultiOptions )
				  );

        $this->addElement('textarea', 'message', array(
                'label' => 'Message',
                'allowEmpty' => false,
                'required' => true,
                'maxlength' => '500',
                'filters' => array(
                        new Engine_Filter_HtmlSpecialChars(),
                        'StripTags',
                        new Engine_Filter_Censor(),
                        new Engine_Filter_StringLength(array('max' => '500')),
                )
        ));		
        
		// Init submit
		$this->addElement ( 'Button', 'submit', array ('label' => 'Request', 'type' => 'submit', 'decorators' => array ('ViewHelper' ) ) );
		
		$this->addElement ( 'Cancel', 'cancel', array ('prependText' => ' or ', 'link' => true, 'label' => 'cancel', 'onclick' => 'parent.Smoothbox.close(); return false;', 'decorators' => array ('ViewHelper' ) ) );
	}
}